<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ page import="com.Database.*" %>
<%@ page import="java.sql.*" %>
<%
   request.setCharacterEncoding("utf-8");
   String id = request.getParameter("id");
   String name = request.getParameter("name");
   String pro = request.getParameter("pro");
   //String sql = "update personinfo set name = '"+name+"',birthProvince = '"+pro+"' where id = "+id;
   conDB DB = new conDB();
   DB.connectDB();
  // Statement state = DB.getConnection().createStatement();
   //int flag = state.executeUpdate(sql);
   String sql = "update personinfo set name = ? , birthProvince = ? where id = ?";
   PreparedStatement state = DB.getConnection().prepareStatement(sql);
   state.setObject(1, name);
   state.setObject(2, pro);
   state.setObject(3, id);
   int flag = state.executeUpdate();
   if(flag > 0)
   {
	   out.print("<script>alert('更新成功！');window.location.href='../update_0.jsp'</script>");
   }
   else
   {
	   out.print("<script>alert('更新失败！');window.location.href='../update_0.jsp'</script>");
   }
   state.close();
%>
